from pylons.i18n import lazy_ugettext as _
from repoze.what.predicates import in_group, is_anonymous, not_anonymous, Any
from chowa.lib.site.navigation import Menu, MenuItem, Tab

__menus__ = [
    Menu('admin', caption=_('Admin panel'),
         protector=in_group('administrators'),
         items = [
            MenuItem(caption=_('Activity'),
                     ignore_all=True,
                     params=dict(controller='admin/site/activity',
                                 action='index')),
            MenuItem(caption=_('Site building'),
                     ignore_all=True,
                     params=dict(controller='admin/layout/panels',
                                 action='index')),
            MenuItem(caption=_('Security'),
                     ignore_all=True,
                     params=dict(controller='admin/security/users',
                                 action='index')),
            MenuItem(caption=_('Organization'),
                     ignore_all=True,
                     params=dict(controller='admin/organization/institutions',
                                 action='index')),
            MenuItem(caption=_('Geography'),
                     ignore_all=True,
                     params=dict(controller='admin/geo/countries',
                                 action='index'))]),
    Menu('user', caption=_('Personal'),
         protector=not_anonymous(),
         items = [
            MenuItem(caption=_('Profile'),
                     ignore_all=True,
                     params=dict(controller='social/profile',
                                 action='index')),
            MenuItem(caption=_('Preferences'),
                     ignore_all=True,
                     params=dict(controller='social/profile',
                                 action='preferences'))]),
    Menu('anonym', caption=_('Site'),
         protector=Any(is_anonymous(), in_group('administrators')),
         items = [
            MenuItem(caption=_('Registration'),
                     ignore_all=True,
                     params=dict(controller='site/pages',
                                 action='view',
                                 id='registration'))]),
]

__primary_tabs__ = [
    [
        Tab(caption=_('List'),
            params=dict(controller='info/organization',
                        action='mailboxes')),
        Tab(caption=_('Edit'),
            params=dict(controller='admin/organization/email',
                        default__action='index'))],
    [
        Tab(caption=_('Blog'),
            params=dict(controller='site/administration',
                        action='blog')),
        Tab(caption=_('About site'),
            params=dict(controller='site/pages',
                        action='view',
                        id='about'))],
    [
        Tab(caption=_('Countries'),
            params=dict(controller='admin/geo/countries',
                        default__action='index')),
        Tab(caption=_('Localities'),
            params=dict(controller='admin/geo/localities',
                        default__action='index')),
        Tab(caption=_('Locality types'),
            params=dict(controller='admin/geo/localitytypes',
                        default__action='index')),
     ]
]
